#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> nums(n);
    for(int i = 0;i  < n;i++) cin >> nums[i];
    int cur = 0;
    int ret = 0;
    while(cur < n)
    {
        if(cur == n - 1)
        {
            ret += 1;
            break;
        }
        if(nums[cur] < nums[cur + 1])
        {
            while(cur < n - 1 && nums[cur] < nums[cur + 1])
            {
                cur += 1;
            }
            ret += 1;
        }
        else if(nums[cur] > nums[cur + 1])
        {
            while(cur < n - 1 && nums[cur] > nums[cur + 1])
            {
                cur += 1;
            }
            ret += 1;
        }
        else if(nums[cur] == nums[cur + 1])
        {
            while (cur < n - 1 && nums[cur] == nums[cur + 1])
            {
                cur += 1;
            }
        }
        cur += 1;
    }
    cout << ret;
    return 0;
}